import React, { Component } from 'react';
import { connect } from 'dva';
import PropTypes from 'prop-types';
import styles from './echartStyle.less';

class LineChart extends Component {
  static propTypes = {
    // secu_code: PropTypes.string.isRequired,
    // type: PropTypes.string,
    chartID: PropTypes.string,
  };

  static defaultProps = {
    chartID: '',
  };

  componentDidMount() {
    const { dispatch, chartID } = this.props;

    dispatch({
      type: 'home/getHldt',
      payload: {
        chartID,
        stock_code: JSON.parse(sessionStorage.getItem('LOGIN_INFO')).stock_code
      },
    });
  }

  render() {
    const { chartID } = this.props;

    return <div id={chartID} className={styles.lineContainer} />;
  }
}

const mapStateToProps = state => ({
  Hmld_data: state.data,
  // data: state.finance.data,
  // desc_info: state.finance.desc_info,
});
export default connect(mapStateToProps)(LineChart);
